package com.itany.controller;

import com.itany.entity.ChatResponse;
import com.itany.service.DeepSeekChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin(origins = "*") // 允许所有域名进行跨域调用
@RestController
public class ChatController {
    @Autowired
    DeepSeekChatService deepSeekChatService;

    /**
     * 处理用户提问的 GET 请求
     * @param question 用户的问题
     * @return DeepSeekChat 的响应
     */
    @GetMapping("/ask")
    public ChatResponse askQuestion(@RequestParam String question) {
        return deepSeekChatService.ask(question);
    }
}